﻿#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    int arr[20][20];
    int up = 0, down = n - 1, left = 0, right = n - 1, sum = 0;
    while (sum < n * n)//一圈一圈求
    {
        for (int j = left; j <= right; j++)
        {
            sum++;
            arr[up][j] = sum;
        }
        up++;
        for (int i = up; i <= down; i++)
        {
            sum++;
            arr[i][right] = sum;
        }
        right--;
        for (int j = right; j >= left; j--)
        {
            sum++;
            arr[down][j] = sum;
        }
        down--;
        for (int i = down; i >= up; i--)
        {
            sum++;
            arr[i][left] = sum;
        }
        left++;
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            printf("%d ", arr[i][j]);
        }
        printf("\n");
    }
    return 0;
}